<template>
  <div>
    <input
      type="checkbox"
      :checked="todo.done"
      @change="changeChecked(todo.id)"
    />
    <span>{{ todo.name }}</span>
    <button @click="deleteObj(todo.id)">删除</button>
  </div>
</template>

<script>
export default {
  name: "MyItem",
  props: ["todo"],
  methods: {
    deleteObj(id) {
      this.$bus.$emit('deleteTask',id)
    },
    changeChecked(id) {
      this.$bus.$emit('changeTaskDone',id)
    },
  },
};
</script>

<style>
</style>